<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

/**
 * 模拟tab产生空格
 * @param int $step
 * @param string $string
 * @param int $size
 * @return string
 */
function tab($step = 1, $string = ' ', $size = 4)
{
    return str_repeat($string, $size * $step);
}
function flag ($code = '', $msg = '', $data = []) {

    $result = [
        'code' => $code,
        'msg' => $msg,
        'data' => $data,
    ];
    return  json_encode($result, 256);
}
// /public/zip/
function mk_dir($base='/public/zip/'){
    $dir = date('Ymd', time());
    if(is_dir($base .$dir)){
        return $base.$dir;
    }else{
        mkdir($base.$dir,0777);
        return $base.$dir;
    }
}